//
//  MoviewDailyCell.m
//  OpenEyes
//
//  Created by dlios on 15/9/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "MoviewDailyCell.h"

@implementation MoviewDailyCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backImageView = [[UIImageView alloc] init];
        self.backImageView.contentMode = 2;
        self.backImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:self.backImageView];
        
        self.blackView = [[UIImageView alloc] init];
        self.blackView.backgroundColor = [UIColor blackColor];
        self.blackView.alpha = 0.3;
        [self.backImageView addSubview:self.blackView];
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont fontWithName:@"HiraKakuProN-W6" size:15];
        self.titleLabel.textColor = [UIColor whiteColor];
        [self addSubview:self.titleLabel];
        
        self.detailLabel = [[UILabel alloc] init];
        self.detailLabel.textAlignment = NSTextAlignmentCenter;
        self.detailLabel.font = [UIFont fontWithName:@"HiraKakuProN-W6" size:13];
        self.detailLabel.textColor = [UIColor whiteColor];
        
        [self addSubview:self.detailLabel];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.backImageView.frame = self.contentView.bounds;
    self.blackView.frame = self.backImageView.bounds;
    self.titleLabel.frame = CGRectMake(0, ConHEIGHT / 2 - 20 , WIDTH, 20);
    self.detailLabel.frame = CGRectMake(0, ConHEIGHT / 2 , WIDTH, 20);
    
    //tableviewCell删除按钮颜色改变
    for (UIView *subView in self.subviews) {
        if ([NSStringFromClass([subView class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"])
        {
            UIView *aView = (UIView *)[subView.subviews firstObject];
            UIImageView *av = [[UIImageView alloc] initWithFrame:aView.frame];
            av.image = [UIImage imageNamed:@"delete"];
            [aView addSubview:av];
            //            ((UIView *)[subView.subviews firstObject]).backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"delete"]];
        }
    }
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
